<?php
defined('SYSPATH') or die('Access error!');
/**
 * 用户的账户类
 * ============================================================================
 * 功能描述： 
 *     主要是显示用户的账户的记录以及处理用户的账户（在线的充值等等）
 * ============================================================================
 * $Author: liuxudong $
 */

class Controller_User_Account extends Controller_User_Main
{

    protected $user_account;

    public function before()
    {
        parent::before();
        $this->user_account = Model::factory('user_account');
        $this->template->assign('current_selected', URL::site('user/account/account'));
        
       //获取账户的详细资料
        $account_detail = $this->user_account->get_user_account($this->user_detail['id']);
        $this->template->assign('data', $account_detail);
    }

    //用户的财务相关
    public function action_account()
    {
        $this->request->redirect('user/account/points');
        $this->template->view('user_account_detail');
    }

    //积分日志
    public function action_points()
    {
        //当前位置
        $this->set_define_position(__('points log list'));
        $this->get_account_log(USER_ACCOUNT_POINTS);
    }

    //RMB日志
    public function action_amount()
    {
        //当前位置
        $this->set_define_position(__('amount log list'));
        $this->get_account_log(USER_ACCOUNT_AMOUNT);
    }

    //经验日志
    public function action_experience()
    {
        //当前位置
        $this->set_define_position(__('experience log list'));
        $this->get_account_log(USER_ACCOUNT_EXPERIENCE);
    }

    public function get_account_log($type)
    {
        $log_list = $this->user_account->get_log_list($type);
        $this->template->assign('log_list', $log_list['list']);
        $this->template->assign('page', $log_list['page']);
        $this->template->view('user_account_log');
    }

}